﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Collections;

namespace Restarty_SIPO3.Class
{
    class Rajon
    {
        private string suma;

        public String IDRajonu { get; set; }
        public String Kod { get; set; }
        public int PocetKlientov { get; set; }
        public String Znamienko { get; set; }

        public String CelkovaSuma
        {
            get
            {
                return suma.Replace(",", ".");
            }
            set
            {
                suma = value;
            }
        }

        public Rajon()
        {
            Zakaznici = new ArrayList();
        }

        public ArrayList Zakaznici { get; set; }

        internal string VytvorRetazec(Subor DataSubor,int SP)
        {
            String tmpStr = null;
            foreach (Posta tmPosta in DataSubor.PolePost)
            {
                foreach (Rajon tmpRajon in tmPosta.Rajony)
                {
                    tmpStr += "(''" + tmpRajon.IDRajonu + "'',''" + tmpRajon.Kod + "''," + tmpRajon.PocetKlientov + ",''" + tmpRajon.Znamienko + "''," + tmpRajon.CelkovaSuma + ",''" + tmPosta.IDPosty + "''," + SP + "),";
                }
            }
            return tmpStr.Substring(0, tmpStr.Length - 1);
        }
    }
}
